// 定义初始化state值
const initState = 0

export default function countReducer(preSate = initState, action) {
  const { type, data } = action
  console.log(type)
  console.log(data)
  // 匹配状态
  switch (type) {
    case 'increment':
      return preSate + data
    case 'decrement':
      return preSate - data
    default:
      return preSate
  }
}
